package org.lanqiao.tjut.controller;

import java.io.IOException;
import java.io.PrintWriter;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.lanqiao.tjut.bean.EmployeeBean;
import org.lanqiao.tjut.model.ModelFactory;


import com.alibaba.fastjson.JSON;

/**
 * 查询操作 EmployeeInfoModalModifySearchServlet
 */
@WebServlet("/EmployeeInfoModalModifySearchServlet")
public class EmployeeInfoModalModifySearchServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//获取参数
		//获取主键id
		String empId = request.getParameter("sid");
		//调用model层 进行id的查询操作
		
		EmployeeBean empB = ModelFactory.getEmployeeInfoAddModelInstance().getEmoloyeeInfoById(empId);
		String strJson = JSON.toJSONStringWithDateFormat(empB,"yyyy-MM-dd HH:mm:ss");
		System.out.println("ajax json"+strJson);
		//使用writer对象将服务器响应内容写到客户端
		PrintWriter pw = response.getWriter();
		pw.write(strJson);
		pw.flush();
		pw.close();
		}

}
